<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/css/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/edit.css" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <form class="form-horizontal m-t js-ajax-forms" id="signupForm" action="">
        <div class="col-sm-8  col-md-offset-2">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <?php $lastClass = null;?>
                    <foreach name="config" item="vo">
                        <?php if($vo['ConfigClass'] !== $lastClass){ ?>
                        <div style="margin-top: 40px;margin-left: 20px;font-weight: bold;border-bottom: 1px solid #ddd;padding-bottom: 10px;margin-bottom: 20px;">邮箱配置</div>
                        <?php }?>
                        <div class="form-group">
                            <label class="col-sm-4 control-label"><?=$configLabel[$vo['ConfigClass'].'_'.$vo['ConfigName']]?></label>
                            <div class="col-sm-8">
                                <input data-name="{$vo.ConfigName}" data-class="{$vo.ConfigClass}" class="form-control" type="text"  value="{$vo.ConfigValue}">
                            </div>
                        </div>
                        <?php $lastClass = $vo['ConfigClass'];?>
                    </foreach>



                    <br>
                    <div class="form-group row">
                        <div class="col-sm-8 col-sm-offset-3">
                            <button class="btn btn-primary" type="button" onclick="saveConfig()">保存</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        </form>
    </div>
</div>

<script src="__ROOT__/Public/Admin/js/jquery.min.js"></script>
<script src="__ROOT__/Public/Admin/js/bootstrap.min.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/layer/laydate/laydate.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>

<script src="__ROOT__/Public/Admin/js/plugins/selector/selector.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/selector/jquery.ztree.all.js"></script>

<script type="text/javascript">
    function saveConfig(){
        var param = [];

        $("input").each(function(){
            var className = $(this).data("class");
            var Name = $(this).data('name');
            var val = $(this).val();
            var obj = {"ConfigClass":className,"ConfigName":Name,"ConfigValue":val};
            param.push(obj);
        });
        $.ajax({
            type:"POST",
            url:"{:U('Admin/Sysconfig/edit')}",
            data:{'param':param},
            success:function(data){
                if (data.status) {
                    //添加成功
                    swal({
                                title: "操作成功！",
                                text: "操作成功！",
                                type: "success",
                                showCancelButton: false,
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "确认",
                                closeOnConfirm: false,
                                closeOnCancel: false
                            },
                            function (isConfirm) {
                                window.location.reload();
                            });
                } else {
                    swal("操作失败", data.info, "error");
                }
            }
        });
    }

</script>
</body>
</html>